﻿@model YuFeng.Models.New.News
@{
    ViewBag.Title = "公司介绍";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<link href="~/Areas/Admin/Content/js/froala_editor/css/froala_editor.css" rel="stylesheet" />
<link href="~/Areas/Admin/Content/js/froala_editor/css/froala_style.css" rel="stylesheet" />
<link href="~/Areas/Admin/Content/js/uploadify/uploadify.css" rel="stylesheet" />
<div class="pageheader">
    <h2><i class="fa fa-book"></i> 公司介绍 <span>编辑公司介绍</span></h2>
    <div class="breadcrumb-wrapper">
        <span class="label">当前位置：</span>
        <ol class="breadcrumb">
            <li><a href="/Admin/News/Index">公司介绍</a></li>
            <li class="active">编辑公司介绍</li>
        </ol>
    </div>
</div>
<div class="contentpanel">
    @using (Html.BeginForm())
    {
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">基本信息</h4>
            </div>
            <div class="panel-body panel-body-nopadding form-horizontal form-bordered">
                @Html.HiddenFor(o => o.Id)
                @Html.HiddenFor(o => o.Title)
                @Html.HiddenFor(o => o.Type)
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        首页缩略图
                    </label>
                    <div class="col-sm-8" id="ArticlePic">
                        <a href="#" id="lnkUpload">上传附件</a>
                        @Html.HiddenFor(e => e.TitleImg)
                        <img id="img-show" src="@YuFeng.Web.Helpers.FilesHelper.GetNewsTitleImg(Model.TitleImg)" class="img-thumbnail" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">
                        首页简介
                    </label>
                    <div class="col-sm-8">
                        @Html.TextAreaFor(e => e.Summary, new { @placeholder = "首页简介", @class = "form-control" })
                    </div>
                </div>
                <div class="form-group" id="TextContent">
                    <label class="col-sm-2 control-label">
                        介绍内容
                        <span class="asterisk">*</span>
                    </label>
                    <div class="col-sm-8">
                        @Html.TextAreaFor(e => e.Content, new { @class = "ue-editor-news", @rows = "10" })
                    </div>
                </div>
            </div><!-- panel-body -->
            <div class="panel-footer">
                <div class="row">
                    <div class="col-sm-8 col-sm-offset-2">
                        <input type="submit" value="保存" class="btn btn-primary" id="btnSave">
                        &nbsp;
                        <a href="/Admin/Home/Index" class="btn btn-link">返回</a>
                    </div>
                </div>
            </div>
            <!-- panel-footer -->
        </div>
    }
</div>
<link href="~/Areas/Admin/Content/js/froala_editor/css/froala_style.css" rel="stylesheet" />
<script src="~/Areas/Admin/Content/js/froala_editor/js/plugins/tables.min.js"></script>
<script src="~/Areas/Admin/Content/js/froala_editor/js/plugins/lists.min.js"></script>
<script src="~/Areas/Admin/Content/js/froala_editor/js/plugins/colors.min.js"></script>
<script src="~/Areas/Admin/Content/js/froala_editor/js/plugins/font_family.min.js"></script>
<script src="~/Areas/Admin/Content/js/froala_editor/js/plugins/font_size.min.js"></script>
<script src="~/Areas/Admin/Content/js/uploadify/jquery.uploadify.js"></script>
<script src="~/Areas/Admin/Content/js/froala_editor/js/froala_editor.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#main_nav-profiles li").each(function (data) {
            if ($(this).find("a").attr("href").indexOf("Introduce") > 0) {
                $(this).addClass("active");
            }
        });
        $("#lnkUpload").uploadify({
            //height: 20,
            buttonText: '上传附件',
            swf: '@Url.Content("~/Areas/Admin/Content/js/uploadify/uploadify.swf")',
            uploader: '/Admin/News/Upload',
            'multi': false,
            'removeCompleted': true,
            'sizeLimit': 0,
            onUploadSuccess: function (file, data, response) {
                var re = $.parseJSON(data);
                if (!!re) {
                    var files = re.Entities;
                    if (files.length > 0) {
                        var file = files[0];
                        $("#TitleImg").val(file.ID);
                        $("#img-show").attr("src", file.PublicUrl).show();
                    }
                }
                else {
                    $.ProcessReturnErrors({ message: "上传返回数据有误！" });
                }
            }
        });
        $('#Content').editable({
            inlineMode: false,
            language: 'zh_cn',
            height: 300,
            imageUploadURL: "/Admin/News/uploadImgs",
            fontList: {
                "SimSun": "宋体",
                "NSimSun": "新宋体",
                "FangSong_GB2312": "仿宋_GB2312",
                "KaiTi_GB2312": "楷体_GB2312",
                "SimHei": "黑体",
                "Microsoft YaHei": "微软雅黑",
                "Arial": "Arial",
                "Arial Black": "Arial Black",
                "Times New Roman": "Times New Roman",
                "Courier New": "Courier New",
                "Tahoma": "Tahoma",
                "Verdana": "Verdana"
            }
        });

        //设置select的选中项（先要给select的data-value赋值，如<select data-value="XX">）
        $("select").each(function () {
            var selectValue = $(this).data("value");
            $(this).find("option[value='" + selectValue + "']").attr("selected", true);
        });
    });
</script>


